//
//  PaperOptionWebCell.m
//  DoingPaper
//
//  Created by zhuxuhong on 16/8/1.
//  Copyright © 2016年 zhuxuhong. All rights reserved.
//

#import "PaperOptionWebCell.h"
#import "QuestionContentView.h"
#import <Masonry/Masonry.h>

@implementation PaperOptionWebCell
{
    QuestionContentView *_contentView;
}

-(instancetype)initWithReuseIdentifier:(NSString*)reuseId
                   contentViewDelegate: (id)delegate
                            contentString: (NSString*)content
                                  baseUrl: (NSString*)url
                           isSingleOption: (BOOL)single
                              atIndexPath: (NSIndexPath*)indexPath{
    
    if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseId]) {
        QuestionContentViewType type = single ? QuestionSingleOption : QuestionMultiOption;
        _contentView = [[QuestionContentView alloc] initWithFrame:CGRectZero viewType:type htmlString:content baseUrl:url atIndexPath:indexPath];
        _contentView.delegate = delegate;
        _contentView.backgroundColor = [UIColor clearColor];
        [self addSubview:_contentView];
        
        [_contentView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(@(0));
        }];
    }
    return self;
}

-(void)setChoosed:(BOOL)choosed{ //用自定义属性 控制icon，selected不好用
    [_contentView setIconSelected:choosed];
    _choosed = choosed;
}

@end
